﻿using System;

namespace DotNetImage.Imaging.Filters
{
    public class EdgeDetectConvolutionFilte : Conv3x3
    {
        [ParameterAttribute(Name = "Treshold", DefaultValue = 0, MinValue = 0, MaxValue = 255, Step = 1)]
        public byte Treshold { get; set; }

        [ParameterAttribute(Name = "Edge Detection Type", DefaultValue = (int)EdgeDetectionType.EDGE_DETECT_QUICK)]
        public EdgeDetectionType DetectionType { get; set; }

        protected override void PrepareData(DotNetImage bmp)
        {
            ConvolutionMatrix m = new ConvolutionMatrix();
            m.TopLeft = m.TopMid = m.TopRight = -1;
            m.MidLeft = m.Pixel = m.MidRight = 0;
            m.BottomLeft = m.BottomMid = m.BottomRight = 1;
            m.Offset = 127;
            base.ConvMatrix = m;
            base.PrepareData(bmp);
        }
    }
}
